import { ecs } from 'db://app-game/libs/ecs/ECS';
import { TableSkillList } from '../../../../table/TableSkillList';
import { SkillReleaseCost } from '../SkillButton.type';

@ecs.register('SkillModel')
export class SkillModelComp extends ecs.Comp {
  table: TableSkillList = new TableSkillList();
  _id: number = -1;
  get id(): number {
    return this._id;
  }
  set id(value: number) {
    this._id = value;
    this.table.init(value);
  }

  /** 技能等级 */
  level: number = 0;
  /** 按钮大小 */
  btnSize: number = 0;
  /** 按钮绝对位置 */
  absolutePos = {
    left: 0,
    top: 0,
  };

  /** 名称 */
  get name(): string {
    return this.table.name;
  }
  /** 详情 */
  get description(): string {
    return this.table.description;
  }
  /** 等级上限 */
  get maxLevel(): number {
    return this.table.maxLevel;
  }
  /** 释放成本 */
  get releaseCost(): SkillReleaseCost {
    return this.table.releaseCost;
  }
  /** 释放材料成本(物品Id和数量) */
  get itemCost(): any {
    return this.table.itemCost;
  }
  /** 冷却时长(s) */
  get cdTime(): number {
    return this.table.cdTime;
  }
  /** 最大蓄力等级 */
  get maxChargeLevel(): number {
    return this.table.maxChargeLevel;
  }
  /** 蓄力阶段数值 */
  get maxChargeTime(): any {
    return this.table.maxChargeTime;
  }
  /** 按钮图片 */
  get iconBtnPath(): string {
    return this.table.iconBtnPath;
  }
  /** 按钮置灰图片 */
  get iconBtnGreyPath(): string {
    return this.table.iconBtnGreyPath;
  }
  /** 按钮遮罩图片 */
  get iconBtnMaskPath(): string {
    return this.table.iconBtnMaskPath;
  }
  /** 动画名称 */
  get animName(): string {
    return this.table.animName;
  }
  /** 预制件 */
  get prefabPath(): string {
    return this.table.prefabPath;
  }
  reset(entity: ecs.Entity): void {
    this._id = -1;
  }
}
